﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>Macaw.Wss4.GoogleAnalyticsSolution</title>
	</head>
	<body>
	
	    <p>
            This solution provides a way to easily implement Google Analytics tracking on 
            your SharePoint Sites.</p>
        <h1>
            Instructions</h1>
        <p>
            For Google Analytics a specialized clientside javascript has to be injected into 
            the page. Upon request of this page, the script will activate and log the page 
            requests to the servers of Google Analytics. It&#39;s advised that the script is placed just 
            before the closing of the body tag.</p>
        <p>
            For injecting the clientside javascript a servercontrol is provided: 
            &quot;Macaw.Wss4.GoogleAnalyticsSolution.GoogleAnalyticsTrackingCode.GoogleAnalyticsTrackingCodeControl&quot;. 
            This servercontrol is best to be placed onto the Masterpages of your site, but 
            can also be placed on the PageLayouts. There 
            are multiple ways to do this:</p>
        <ul>
            <li>By placing a DelegateControl onto your Masterpage:<br />
&nbsp;&nbsp;&nbsp; &lt;body&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;SharePoint:DelegateControl 
                ControlId=&quot;GoogleAnalyticsTrackingCode&quot; runat=&quot;server&quot; 
                AllowMultipleControls=&quot;false&quot;/&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/body&gt;<br />
                This serves as a placeholder for the SiteCollection Feature 
                &quot;Macaw.Wss4.GoogleAnalyticsSolution GoogleAnalytics Tracking Code&quot;. Upon 
                activation of this feature the servercontrol will be placed within this 
                DelegateControl.<br />
                The main advantage of this technique is, that it&#39;s very loosely coupled. No 
                error will occur if the DelegateControl is not present or the Solution is 
                retracted.<br />
            </li>
            <li>By placing the servercontrol directly onto your Masterpage:<br />
&nbsp;&nbsp;&nbsp; &lt;%@ Register Tagprefix=&quot;GoogleAnalyticsTrackingCode&quot; 
                Namespace=&quot;Macaw.Wss4.GoogleAnalyticsSolution.GoogleAnalyticsTrackingCode&quot; 
                Assembly=&quot;Macaw.Wss4.GoogleAnalyticsSolution, Version=1.0.0.0, Culture=neutral, 
                PublicKeyToken=67be611495116c27&quot; %&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;body&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                &lt;GoogleAnalyticsTrackingCode:GoogleAnalyticsTrackingCodeControl runat=&quot;server&quot; 
                /&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/body&gt;</li>
        </ul>
        <h1>
            Configuration</h1>
        <p>
            There are multiple ways of configuring the Tracking.</p>
        <ul>
            <li>It&#39;s possible to create a copy of this Solution and modify the Elements.xml and 
                specify the default Tracking settings and rebuild a custom WSP.</li>
            <li>It&#39;s possible to activate the Feature &quot;GoogleAnalyticsTrackingConfiguration&quot; and 
                use the GoogleAnalyticsSolution UserInterface to override the default Tracking 
                settings.</li>
            <li>It&#39;s possible to put the default settings as attributes on the customcontrol</li>
        </ul>
        <p>
            The default tracking settings can/will be overridden 
            by the 
            settings which are done via the GoogleAnalyticsSolution UserInterface.</p>
        <p>
            The GoogleAnalyticsTrackingCodeControl has the following properties:</p>
        <dl>
            <dt>TrackerCode</dt>
            <dd>
                The default TrackerCode which will be used inside the Tracking Script</dd>
            <dl>
                <dt>TrackAuthenticated</dt>
                <dd>
                    The default setting wether the pages requested by authenticated users should be 
                    tracked</dd>
            </dl>
            <dt>TrackEditMode</dt>
            <dd>
                The default setting wether the edit mode should be tracked</dd>
        </dl>
        <p>
            The configuration set via the GoogleAnalyticsSolution UserInterface will get 
            stored as CustomProperties on SPFile and SPFolder . It&#39;s important to be aware that these 
            settings get exported and also deployed via ContentDeployment.</p>
        <p>
            Upon activation of the Configuration Feature three links will be provided to 
            manage the settings:
            <ul> 
                <li>Two links will be integrated into the Ribbon at the Page Actions group.<br /> 
                <img src="Documentation/ConfigurationAtRibbon.png" width="50%" />
            </li>
                <li>The other link will be added to the SiteSettings page.<br />
                <img src="Documentation/ConfigurationAtSiteSettings.png" width="30%" />
                </li>                 
            </ul>
            All links are context-aware. This means that when one clicks on the &quot;Manage Google 
            Analytics&quot;-link of the PageAction, you will define the settings for that page 
            (SPFile). The &quot;Manage Google Analytics&quot;-link of the Library-group will modify 
            the specific library (SPFolder).<p>
            Please be aware that it might be neccesary to flush your browser-cache to set 
            the links in the Ribbon.&nbsp;</p>
&nbsp;<img src="Documentation/ManagePage.png" width="50%" /><br />
        <br />
            <img src="Documentation/ManageLibrary.png" width="50%" /><br />
        <br />
            <img src="Documentation/ManageWeb.png" width="50%" /><br />
        </p>
        <p>
            &nbsp;</p>
        <p>
            As of SP2010 it would be technically possible to create Pages in SubFolders of 
            the Pages-folder. Although not tested, this solution would be compatible with 
            this.</p>
        <p>
            Notes:</p>
        <p>
            Unfortunatly it was not possible to provide this solution as a Sandboxed 
            Solution as no SafeControl-entry would be registered and the DelegateControl 
            would not load.This is bydesign, see:
            <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.delegatecontrol(office.14).aspx">
            microsoft.sharepoint.webcontrols.delegatecontrol</a><br />
            Also it&#39;s not possible to use an ascx in sandboxed solutions.</p>
	
	</body>
</html>